<me:UIWBBST x:Class="WPFExcelReport.TWB4X"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT" 
                    xmlns:WS="clr-namespace:WPFExcelReport;assembly=TWASTAMM" 
                    xmlns:BW="clr-namespace:WPFExcelReport;assembly=TWBBEW" 
                    xmlns:WB="clr-namespace:WPFExcelReport;assembly=TWBDAT" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    x:Name="TV"
                    Background="White"  
                    Loaded="Window_Loaded"
     >
    <me:UIWBBST.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:KM2YD x:Key="KM2YD"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIWBBST.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
            <WrapPanel  Margin="10,10,0,0" VerticalAlignment="Top" >
                <WB:TWB04 Name="cWB04"  RWAUF="{Binding RWAUF,ElementName=TV}" />
            </WrapPanel>
            <WrapPanel Margin="10,10,0,0" VerticalAlignment="Top" >
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" FontSize="18" Text="{Binding Source={Localization:Translate Word=卷号:}}"></TextBlock>
                    <ex:TXT72  MaxLength="12" Grid.Column="1" FontSize="18"  Foreground="Red"   Text="{Binding WBBSTKNR,ElementName=TV}" Width="160" />
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="QueryCommand" Height="40" Margin="5,0,0,0" Width="40" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" FontSize="18" Text="{Binding Source={Localization:Translate Word=目标长度:}}"></TextBlock>
                    <ex:NumericBox  Text="{Binding CMTR,Converter={StaticResource d1000}, ElementName=TV}" Grid.Column="1" FontSize="18"   Width="80" />
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="40" Margin="5,0,0,0" Width="40" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Cut.png" />
                        </Button.Background>
                    </Button>
                    <TextBox Name="txtCUT" Grid.Column="1" FontSize="18" Text="N" Width="30" CharacterCasing="Upper" VerticalAlignment="Top"/>
                </Grid>
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1" Grid.Column="0" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster" 
                    RowDetailsVisibilityMode="Visible"  Margin="0,0,0,0">
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=WBBAUFKRS}"   Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WBBAUFLFD,Converter={StaticResource pnum}}" Header="{Binding Source={Localization:Translate Word=销售单}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WBBAUFPOS}"   Width="Auto" />
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=布卷号}}" Binding="{Binding WBBSTKNR, Converter={StaticResource ResourceKey=pnum}}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=小卷号}}" Foreground="Red" Binding="{Binding WBBPACKNR, Converter={StaticResource ResourceKey=pnum}}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=数量(米)}}" Binding="{Binding WBBISTKLG,Converter={StaticResource ResourceKey=d1000}}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=数量(码)}}" Binding="{Binding WBBISTKLG,Converter={StaticResource ResourceKey=KM2YD}}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=格型}}" Binding="{Binding WBBDPART}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=色级}}" Binding="{Binding WBBTAX}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=后整理}}" Binding="{Binding WBBBESCHICH}" Visibility="Collapsed"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=重量(KG)}}" Binding="{Binding WBBSGEW}" Visibility="Collapsed"/>
                <DataGridTextColumn Binding="{Binding Path=WBBURLIEFSCH,Converter={StaticResource pnum}}" Header="{Binding Source={Localization:Translate Word=发货单}}"  Width="Auto" />
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=原卷号}}" Binding="{Binding WBBDPART2}"  Visibility="Collapsed" Width="60"/>
            </DataGrid.Columns>
        </DataGrid  >
    </Grid>
</me:UIWBBST>
